--Fixes the League of Legends Window on launch by resizing it to the correct values
--Restarts League of Legends on Bugsplat
os.executePowerShell([[#Written By gReY
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class User32 {
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll")]
public static extern bool SetForegroundWindow(IntPtr hWnd);
}
"@
$h = (Get-Process "League of Legends").MainWindowHandle;
[User32]::SetWindowPos($h,0,0,0,]]..WINDOW_W..[[,]]..WINDOW_H..[[,0x4000+0x0040);
[User32]::ShowWindowAsync($h,9);
[User32]::SetForegroundWindow($h);]])
function OnBugSplat()
	os.executePowerShell([[
	$exePath = (gps "League of Legends").path
	$installFolder = $exePath -replace "League of Legends.exe", "";
	$cmd = "`$i = 0; `$started = 0; while(`$i -le 320){if((Get-Process BsSndRpt -ErrorAction SilentlyContinue) -ne `$null){Stop-Process -processname BsSndRpt;} if(((Get-Process 'League of Legends' -ErrorAction SilentlyContinue) -eq `$null) -and (`$started -eq 0)){`$started = 1; Start-Process '" + $exePath + "' -WorkingDirectory '" + $installFolder + "';} Start-Sleep -s 1; `$i++;}";
	$arg = '-windowstyle hidden -nologo -noprofile -executionpolicy bypass -command "' + $cmd + '"';
	Start-Process powershell -argument $arg;]])
	QuitGame()
end